import { Component } from "react";
import One from "./One"

export default class Parent extends Component{
    state={
        m:10,
        flag:true
    }
    changeM=()=>{
        this.setState({
            m:20
        })
    }
    render(){
        let {flag}=this.state;
        return <div>
            {flag?<One m={this.state.m}></One>:null}
            <button onClick={this.changeM}>点击修改M</button>
           <button onClick={()=>{
               this.setState({
                  flag:false
               })
           }}>卸载One组件</button>
        </div>
    }
}
